// Author: Ivan Kazmenko (gassa@mail.ru)
module solution;
import std.algorithm;
import std.range;
import std.stdio;

immutable int limit = 20_001;

int solve (int a, int x, int b, int y, int n)
{
	auto f = new int [limit];
	f[] = int.max;
	int [] q;

	void add (int v, int d)
	{
		if (v >= limit || f[v] != int.max)
		{
			return;
		}
		f[v] = d;
		q ~= v;
	}

	add (n, 0);
	while (!q.empty)
	{
		int cur = q.front;
		q.popFront ();
		q.assumeSafeAppend ();
		if (cur > a)
		{
			add (cur - a + x, f[cur] + 1);
		}
		if (cur > b)
		{
			add (cur - b + y, f[cur] + 1);
		}
	}

	int res = min (f[a], f[b]);
	if (res == int.max)
	{
		res = -1;
	}
	return res;
}

void main ()
{
	int a, x;
	int b, y;
	int n;
	while (readf (" %s %s", &a, &x) > 0)
	{
		readf (" %s %s", &b, &y);
		readf (" %s", &n);
		writeln (solve (b, y, a, x, n));
	}
}
